package com.example.saiweisi.service.impl.sysTemAdminService;

import com.example.saiweisi.controller.request.ClothesKindRequest;
import com.example.saiweisi.controller.request.PageBaseRequest;
import com.example.saiweisi.mapper.systemAdminMapper.ClothesKindMapper;
import com.example.saiweisi.model.ClothesKind;
import com.example.saiweisi.service.interf.IClothesKindService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ClothesKindService implements IClothesKindService {
    @Autowired
    ClothesKindMapper clothesKindMapper;
    @Override
    public PageInfo<ClothesKind> page(ClothesKindRequest clothesKindRequest) {
        PageHelper.startPage(clothesKindRequest.getPageNum(), clothesKindRequest.getPageSize());
        List<ClothesKind> userList = clothesKindMapper.clotheskindlistByCondition(clothesKindRequest);
        return new PageInfo<>(userList);
    }

    @Override
    public void addclotheskind(ClothesKind clothesKind) {
        clothesKindMapper.addclotheskind(clothesKind);
    }

    @Override
    public void deleteclotheskind(Integer clothesKindId) {
        clothesKindMapper.deleteclotheskind(clothesKindId);
    }

    @Override
    public ClothesKind getById(Integer clothesKindId) {
        return clothesKindMapper.getById(clothesKindId);
    }

    @Override
    public void updateclotheskind(ClothesKind clothesKind) {
        clothesKindMapper.updateclotheskind(clothesKind);
    }

    @Override
    public void deletesclotheskind(List<Integer> clothesKindIds) {
        for (Integer a:clothesKindIds
             ) {
            clothesKindMapper.deleteclotheskind(a);
        }
    }

    @Override
    public List<ClothesKind> getall() {

        return clothesKindMapper.getall();
    }
}
